package com.souku.finance.application.ui.more;

import android.os.Bundle;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;

import com.souku.finance.application.R;
import com.souku.finance.application.base.BaseTitleBarActivity;
import com.souku.finance.application.http.UrlConstact;
import com.souku.finance.application.ui.invite.PayWebActivity;
import com.souku.finance.application.utils.Constant;
import com.souku.finance.application.utils.ShareUtil;

import butterknife.BindView;
import butterknife.ButterKnife;

public class BankCard2Activity extends BaseTitleBarActivity {

    @BindView(R.id.web_view)
    WebView webView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bank_card2);
        ButterKnife.bind(this);
        //设置WebView属性，能够执行Javascript脚本
        String userId = ShareUtil.getInstance().getString(Constant.UserId);
        String accessToken = ShareUtil.getInstance().getString(Constant.Token);

        String str = "memberId=" + userId + "&appId=APP&accessToken=" + accessToken;

        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setUseWideViewPort(true);
        webView.getSettings().setLoadWithOverviewMode(true);
        webView.addJavascriptInterface(new AppJavascriptInterface(), "skAppjs");
        //加载需要显示的网页
        webView.postUrl(UrlConstact.PAY_BINDING_BANK, str.getBytes());
    }

    @Override
    public void internet() {

    }

    class AppJavascriptInterface {

        @JavascriptInterface
        public void backApp() {
            finish();
        }

    }
}
